<!DOCTYPE html>
<script>
    var templates = null;
    $(function(){
        $("#database-tables").datagrid({
            border:false,
            fit:true,
            striped:true,
            nowrap:true,
            singleSelect:true,
            rownumbers:true,
            fitColumns:true,
            columns:
                [[
                    {field:'tableName',title:'表名',width:200},
                    {field:'remarks',title:'备注',width:200}
                ]],
            onDblClickRow: function(index,row){
                if(window.confirm("是否要生成代码模板？")){
                    var url = "/template/download";
                    var $form = $('<form method="post" action="/template/download" target="_blank"></form>');
                    $form.append('<input type="hidden" name="tableName" value="'+row.tableName+'"/>');
                    $form.appendTo('body').submit().remove();
                }
            }
        })
    })
</script>
<table id="database-tables"></table>